﻿@{
    Layout = "~/Views/Shared/_Form.cshtml";
}
<script>
    $(function () {
        var storage = window.localStorage;
        var json = storage.getItem("mList");
        var jsonObj = JSON.parse(json);
        gridlist(jsonObj);
    });

    function gridlist(mList) {
        $("#gridlist").dataGrid({
            autoScroll: true,
            caption: "药品信息",
            height: 200,
            colModel: [
                { label: '药品编码', name: 'ypCode', width: 50, align: 'left' },
                { label: "主键", name: "sldmxId", hidden: true, key: true },
                { label: '申领单号', name: 'sldh', width: 50, align: 'left', hidden: true, },
                 { label: '拼音', name: 'py', width: 50, align: 'left', hidden: true, },
                 { label: '批号', name: 'Ph', width: 100, align: 'left' },
                 { label: '批号', name: 'pc', hidden: true, width: 50, align: 'left' },
                 { label: '有效日期', name: 'Yxrq', width: 120, align: 'left' },
                 { label: '生产厂家', name: 'ycmc', width: 100, align: 'left' },
                 { label: '单位', name: 'bzdw', width: 50, align: 'left' },
                { label: '药品名称', name: 'ypmc', width: 150, align: 'left' },
                { label: '批发价', name: 'Pfj', width: 50, align: 'left' },
                { label: '零售价', name: 'lsj', width: 50, align: 'left' },
                { label: '申领数量', name: 'Sl', width: 50, align: 'left' },
                { label: '已发放数量', name: 'yfsl', align: 'left' },
                { label: '发放数量', name: 'ffsl', align: 'left' },
                { label: '批发总额', name: 'Pjze', width: 50, align: 'left' },
                 { label: '零价总额', name: 'Ljze', width: 50, align: 'left' },
                 { label: '转换因子', name: 'Zhyz', align: 'left', hidden: true, }
            ],
            pager: "#gridPager",
            sortname: 'sldmxId desc',
            viewrecords: true
        });
        if (mList.length > 0) {
            $('.ui-jqgrid-bdiv').find(".unwritten").remove();
            for (var i = 0; i < mList.length; i++) {
                jQuery("#gridlist").jqGrid('addRowData', i + 1, mList[i]);
            }
            $("#gridList").trigger("reloadGrid");
        }
    }
</script>

<div class="gridPanel">
    <div style="margin-bottom:10px">
        <table id="gridlist"></table>
        <div id="gridPager" rel="form1"></div>
    </div>
</div>